package com.ruoyi.project.loan.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.loan.domain.ApplicationDocument;
import com.ruoyi.project.loan.mapper.ApplicationDocumentMapper;
import com.ruoyi.project.loan.service.IApplicationDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 申请材料Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-11
 */
@Service
public class ApplicationDocumentServiceImpl implements IApplicationDocumentService {
    @Autowired
    private ApplicationDocumentMapper applicationDocumentMapper;

    /**
     * 查询申请材料
     *
     * @param docId 申请材料主键
     * @return 申请材料
     */
    @Override
    public ApplicationDocument selectApplicationDocumentByDocId(Long docId) {
        return applicationDocumentMapper.selectApplicationDocumentByDocId(docId);
    }

    /**
     * 查询申请材料列表
     *
     * @param applicationDocument 申请材料
     * @return 申请材料
     */
    @Override
    public List<ApplicationDocument> selectApplicationDocumentList(ApplicationDocument applicationDocument) {
        return applicationDocumentMapper.selectApplicationDocumentList(applicationDocument);
    }

    /**
     * 新增申请材料
     *
     * @param applicationDocument 申请材料
     * @return 结果
     */
    @Override
    public int insertApplicationDocument(ApplicationDocument applicationDocument) {
        applicationDocument.setCreateTime(DateUtils.getNowDate());
        return applicationDocumentMapper.insertApplicationDocument(applicationDocument);
    }

    /**
     * 修改申请材料
     *
     * @param applicationDocument 申请材料
     * @return 结果
     */
    @Override
    public int updateApplicationDocument(ApplicationDocument applicationDocument) {
        applicationDocument.setUpdateTime(DateUtils.getNowDate());
        return applicationDocumentMapper.updateApplicationDocument(applicationDocument);
    }

    /**
     * 批量删除申请材料
     *
     * @param docIds 需要删除的申请材料主键
     * @return 结果
     */
    @Override
    public int deleteApplicationDocumentByDocIds(Long[] docIds) {
        return applicationDocumentMapper.deleteApplicationDocumentByDocIds(docIds);
    }

    /**
     * 删除申请材料信息
     *
     * @param docId 申请材料主键
     * @return 结果
     */
    @Override
    public int deleteApplicationDocumentByDocId(Long docId) {
        return applicationDocumentMapper.deleteApplicationDocumentByDocId(docId);
    }
}
